/**
 * 继承Thread创建线程
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        //获得当前线程
        Thread mainThread=Thread.currentThread();
        System.out.println("线程名称:"+mainThread.getName());
        Thread thread=new MyThread();
        //开启线程
        // thread.run();
        thread.start();

    }
}
class MyThread extends Thread{
    @Override
    public void run(){
        //具体的业务执行代码
        System.out.println("你好，编程");
        Thread thread=Thread.currentThread();
        System.out.println("线程的名称:"+thread.getName());
    }
}